from PyQt5.QtWidgets import QWidget, QLineEdit, QHBoxLayout, QPushButton, QMainWindow


class component(QWidget):
    def __init__(self, parent=None):
        super(component, self).__init__(parent)
        layout = QHBoxLayout()
        text = QLineEdit('我是自定义的控件')
        button = QPushButton("按钮")
        layout.addWidget(text)
        layout.addWidget(button)
        self.setLayout(layout)